package cn.zswltech.gruul.web.api.util;

import org.springframework.core.NamedThreadLocal;

/**
 * 测试时白名单处理
 *
 * @author wangchuanhao
 * @date 2022/6/29 3:24 PM
 */
public class WhiteListUtil {

    private static final ThreadLocal<Boolean> whiteListFlagHolder =
            new NamedThreadLocal<>("whiteListFlagHolder");

    public static Boolean getWhiteListFlag() {
        return whiteListFlagHolder.get();
    }

    public static void reset() {
        whiteListFlagHolder.remove();
    }

    public static void setWhiteListFlagHolder(Boolean whiteListFlag) {
        whiteListFlagHolder.set(whiteListFlag);
    }

}
